//
import { http } from '@/utils/http'
import { OrderResponse, RefundData } from './order.type'
// 获取首页数据 /order/orders
export const getOrderList = (data: { status: number; page: number }) => {
  return http.post<OrderResponse>('order/orders', data)
}
// 取消订单 /order/cancel
export const cancelOrder = (data: { id: number | string; reason: string }) => {
  return http.post('order/cancel', data)
}
// 订单详情 order/detail
export const getOrderDetail = (id: number | string, type: number | string = 0) => {
  return http.post<OrderResponse>(`order/detail`, { id, type })
}
// 确认收获 /order/comment
export const confirmReceipt = (data: { id: number | string; comment: string }) => {
  return http.post('order/comment', data)
}
// 获取物流信息 /order/express
export const getExpressInfo = (id: number | string, type: number | string) => {
  return http.post(`order/express`, { id, type })
}
// 确认收获 /order/confirmReceive
export const confirmReceive = (id: number | string) => {
  return http.post('order/confirmReceive', { id })
}
// 获取已经评价的订单 /order/commented
export const getCommentedOrder = (page: number) => {
  return http.post<OrderResponse>('order/commented', { page })
}
// 退款申请页 /order/refundApply
export const postRefundApply = (data: any) => {
  return http.post<OrderResponse>('order/refundApply', data)
}
// 退款详情页 /order/refundPage
export const getRefundPage = (id: number | string, refundId: number | string) => {
  return http.post<OrderResponse>('order/refundPage', { id, refundId })
}
// 退款申请 /order/refundExpress
export const postRefundExpress = (data: RefundData) => {
  return http.post('order/refundExpress', data)
}
